public class TestMain {

	public static void main(String[] args) {
		int totalLength = 100;
		int searchLength = 20;
		int[] total = new int[totalLength];
		int[] search = new int[searchLength];

		System.out.print("total: ");
		for (int i = 0; i < totalLength; i++) {
			// total[i]=(int)(Math.random()*totalLength);
			total[i] = i * 6;
			System.out.print(total[i] + " ");
		}
		System.out.println("");
		System.out.print("search: ");
		for (int i = 0; i < searchLength; i++) {
			// search[i]=(int)(Math.random()*searchLength);
			search[i] = (i+1) * 12;
			System.out.print(search[i] + " ");
		}
		int tempLength = totalLength;

		int start = 0;
		int end = tempLength - 1;
		int middle = 0;
		int oldmiddle = -1;
		while (oldmiddle != middle) {
			oldmiddle = middle;
			if (search[searchLength - 1] <= total[middle]) {
				// 则限定了最大范围
				end = middle - 1;

			} else if (search[0] >= total[middle]) {
				// 则限定了最小范围
				start = middle + 1;
			}
			System.out.println("(start,end)" + "(" + start + "," + end
					+ ") -->middle" + middle);
			System.out.println();
			middle = (start + end) / 2;
		}

		boolean flag = true;

		for (int i = 0; i < searchLength; i++) {
			boolean singleflag = false;
			for (int j = start; j < end; j++) {
				if (search[i] == total[j]) {
					singleflag = true;
					break;
				}
			}

			if (!singleflag) {
				flag = false;
				break;
			}

		}

		if (flag) {
			System.out.println("包含");
		} else {
			System.out.println("不包含");
		}

	}

}
